/* File epipolar.h */

#ifndef _EPIPOLAR_H_
#define _EPIPOLAR_H_

/* OpenCV */
#include <opencv2/opencv.hpp>

/*
	My own data structures
*/
typedef struct EpipolarData
{
    CvMat* epipole;
    CvMat* fundamental_matrix;
    int count; // number of epipoles or fundamental matrices
    
	EpipolarData();
	int append(const CvMat* e, const CvMat* f);
	double e(int m, int i);
	double f(int m, int i, int j);
	void print();

} EpipolarData;

void calrotationmat(double x, double y, double z, double *R);
void T2S(const double *T, double *S);
void calepipole(CvMat *F, CvMat *el, CvMat *er);
void allpair_epipolar(CvCapture *video, EpipolarData *epipolar, const int feature_num, const int frame_step);
void factorizeF(const CvMat *F, const CvMat *p, CvMat *M);
void reconstruct3Dfrom2view(const CvMat *u1, const CvMat *u2, const CvMat *p2, const CvMat *M, CvMat *x);

#endif